package dhbw.GUI.Menu;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import Main.MyController;

public class MyMenubar extends JMenuBar {

	private MyController myc;
	
	public MyMenubar(MyController myc, String data)
	{
		this.myc = myc;
		buildDefaultMenubar(data);
	}

	/**
	 * Builds the JMenubar, gets the Role of actual User as String
	 * @param data
	 */
	private void buildDefaultMenubar(String data) {
			
		if(data.equals("Professor"))
		{
			this.add(new MenuDatei(myc,true));	
			this.add(new MenuProfessor(this.myc));
		}
		if(data.equals("Dozent"))
		{
			this.add(new MenuDatei(myc,true));	
			this.add(new MenuDozent(this.myc));
		}
		if(data.equals("Student"))
		{
			this.add(new MenuDatei(myc,false));	
			this.add(new MenuStudent(this.myc));
		}
		if(data.equals("Studiengangsleiter"))
		{
			this.add(new MenuDatei(myc,true));	
			this.add(new MenuStudiengangsleiter(this.myc));
		}
		
		this.add(new MenuHelp(this.myc));
	}
}
